package com.haitaoit.chengquan.module.center.activity.xuqiu;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.haitaoit.chengquan.R;
import com.haitaoit.chengquan.base.BaseActivity;
import com.haitaoit.chengquan.main.MianButtonActivity;
import com.haitaoit.chengquan.module.center.activity.order.MyOrderActivity;
import com.haitaoit.chengquan.module.home.activity.maintenance.QFacilityMaintenanceActivity;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

public class PaySuccessActivity extends BaseActivity {
    @ViewInject(R.id.ps_type)
    TextView ps_type;
    @ViewInject(R.id.ps_content)
    TextView ps_content;
    @ViewInject(R.id.ps_tv1)
    TextView ps_tv1;
    @ViewInject(R.id.ps_tv2)
    TextView ps_tv2;
    @ViewInject(R.id.ps_tv3)
    TextView ps_tv3;
    @ViewInject(R.id.ps_tv4)
    TextView ps_tv4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView_V(R.layout.activity_pay_success);
        setLeftShow(1, R.mipmap.left);
        backLeft_V();
        ViewUtils.inject(this);

        if (getIntent().getStringExtra("type").equals("car_order")) {
            setTitle_V("支付成功");

            ps_type.setText("支付成功");
            ps_content.setText("您已付款成功，平台将很快处理，您的订单请在个人中心-我的订单中关注订单进度");
            ps_tv1.setVisibility(View.GONE);
            ps_tv2.setVisibility(View.GONE);
            ps_tv3.setVisibility(View.VISIBLE);
            ps_tv4.setVisibility(View.GONE);
        } else if (getIntent().getStringExtra("type").equals("fuwu")) {// 预约服务
            setTitle_V("支付成功");

            ps_type.setText("支付成功");
            ps_content.setText("您已付款成功，服务商将很快与您联系，并在您预约的时间进行上门服务！");
            ps_tv1.setVisibility(View.GONE);
            ps_tv2.setVisibility(View.GONE);
            ps_tv3.setVisibility(View.GONE);
            ps_tv4.setVisibility(View.VISIBLE);
        } else if (getIntent().getStringExtra("type").equals("xiuqiu_order")) {
            setTitle_V("提交成功");
            ps_type.setText("预约订单成功");
            ps_content.setText("您已经成功预约本服务，服务商将很快与您联系，并在您预约的时间段商评估价格并服务");
            ps_tv4.setVisibility(View.VISIBLE);
            ps_tv2.setVisibility(View.GONE);
            ps_tv3.setVisibility(View.GONE);
            ps_tv1.setVisibility(View.GONE);
        }else if (getIntent().getStringExtra("chioceok").equals("chioceok")){
            setTitle_V("供应商选择成功");
            ps_type.setText("选择成功");
            ps_content.setText("您已付款成功，供应商已经收到您的订单信息，很快将上门服务，请耐心等待");
            ps_tv4.setVisibility(View.GONE);
            ps_tv2.setVisibility(View.GONE);
            ps_tv3.setVisibility(View.GONE);
            ps_tv1.setVisibility(View.VISIBLE);
        }else {
            setTitle_V("支付成功");

            ps_type.setText("支付成功");
            ps_content.setText("您已付款成功，服务商将很快与您联系，并在您预约的时间进行上门服务！");
            ps_tv1.setVisibility(View.GONE);
            ps_tv2.setVisibility(View.GONE);
            ps_tv3.setVisibility(View.GONE);
            ps_tv4.setVisibility(View.VISIBLE);
        }
    }

    @OnClick({R.id.ps_tv1, R.id.ps_tv2, R.id.ps_tv3, R.id.ps_tv4,})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ps_tv1:// 返回会员中心
                Intent intent2 = new Intent(PaySuccessActivity.this, MianButtonActivity.class);
                intent2.putExtra("index", "3");
                startActivity(intent2);
                finish();
                break;
            case R.id.ps_tv2:// 继续发布服务  不做了
                break;
            case R.id.ps_tv3:// 查看订单进度
                Intent intent = new Intent(this, MyOrderActivity.class);
                intent.putExtra("order_type", "all");
                startActivity(intent);
                finish();
                break;
            case R.id.ps_tv4:// 查看其他服务
                Intent intent1 = new Intent(this, QFacilityMaintenanceActivity.class);
                startActivity(intent1);
                finish();
                break;
        }
        super.onClick(v);
    }
}
